home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12075 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: cp.prima.ruhr.de!Diedrich_Vorberg
  2. Date: 17 Mar 1996 01:01:00 +0200
  3. From: Diedrich_Vorberg@cp.prima.ruhr.de (Diedrich Vorberg)
  4. Newsgroups: comp.lang.c++
  5. Message-ID: <650axk$dXdB@cp.prima.ruhr.de>
  6. References: <4ifajv$4n7s@uvaix3e1.comp.UVic.CA>
  7. Subject: Re: pointer questions
  8. X-Newsreader: CrossPoint v3.1
  9.  
  10. Hello Colin !
  11.  
  12. (Colin Gesy)  hat neulich folgendes geschrieben:
  13. (Colin Gesy)  wrote this a some time ago:
  14. > Could someone tell me if there is a difference
  15. > between the declaration "int *thing_ptr" and
  16. > "int* thing_ptr" ?
  17. > Also, what is the difference between "int& data"
  18. > and "int &data" ?
  19.  
  20. There is no difference at all. What to write is rather a matter of taste.
  21.  
  22. > What does the following statement do/mean? :
  23. >
  24. >      ((searchItem&) *this)._refCount++;   //searchItem is the class name
  25. >
  26.  
  27. Er --- Ok, ok, ok....
  28. (searchItem&) is a typecaste.
  29. *this refes to  the object the "this" pointer is pointing to (the current
  30.                                                                     class)
  31. _refCount is a member of the class "searchItem", which is increased.
  32. The line
  33.   ((searchItem*) this) -> _refCount ++;
  34. is doing the same thing: The type of "this" is changed and with a member  
  35. of the new type is done something. The only thing the first version is  
  36. doing more is, it makes a pointer apear as a reference.
  37.  
  38. Hope, I could help you .. though I think I couldn't realy...
  39. Diedrich :-)
  40. -- 
  41. From me to you with love and in friendship !
  42. Internet: Diedrich_Vorberg@cp.prima.ruhr.de
  43. FIDO: 2:2444/4538.14 Point der KASIMIR BBS +49-2330-890348
  44. Bundespost: Diedrich Vorberg, Am Vorberg 12, 58300 Wetter
  45.